
define(function(require, exports, module) {
  var $, _;
  exports.mc = require('mustache');
  exports.JSON = require("json");
  exports.jsonHelp = require("./front_net/module-zic/jsonhelp");
  _ = exports._ = require("underscore");
  $ = exports.jq = require('jquery');
  $.ajaxSetup({
    type: "POST",
    dataType: "json",
    contentType: "application/x-www-form-urlencoded; charset=utf-8"
  });
  require('./front_net/module-zic/prototype').Arrayhelp();
  require('./front_net/module/artDialog5/amd/artDialog5')($);
  require('./front_net/module-zic/area/area2')($, _, exports.mc);
  require('./front_net/module/mousewheel')($);
  require('./front_net/module/fancybox/fancybox')($);
  require('./front_net/module/fancybox/fancybox-thumbs')($);
  require('./front_net/module-zic/placeholder')($);
  require('./front_net/module-zic/bracket')($);
  require('./front_net/module/cookie')($);
  require('./front_net/module/chosen')($);
  require('./front_net/module/validation')($, _);
  require('./front_net/bootstrap/amd/bootstrap-dropdown')($);
  require('./front_net/bootstrap/amd/bootstrap-button')($);
  require('./front_net/bootstrap/amd/bootstrap-typeahead-zic')($);
  require('./front_net/bootstrap/amd/bootstrap-datepicker')($);
  require('./front_net/bootstrap/amd/bootstrap-alert')($);
  exports.mod_itemAct = require('./scripts/itemAct');
  exports.ld_logo = function() {
    var logos;
    logos = $("a.brand-light, a.brand-dark");
    return logos.hover(function() {
      return logos.addClass("hover", 1000);
    }, function() {
      return logos.removeClass("hover", 1000);
    });
  };
  exports.dialog_config = {
    fixed: true,
    lock: true,
    opacity: 0.1
  };
  exports.check_result = function(e, request) {
    if (e.error) {
      if (e.error === "need_login") {
        exports.dialogin(request);
      } else {
        $("#main-error").show().children("strong").text(e.error);
      }
      return false;
    }
    if (e.warn) {
      $("#main-alert").show().children("strong").text(e.warn);
    }
    return true;
  };
  exports.dialogin = function(prerequest) {
    var dialogin, dialogin_box;
    dialogin_box = $("#dialogin");
    return dialogin = $.dialog(exports._.extend({
      content: dialogin_box[0],
      initialize: function() {
        return $("a.submit", dialogin_box).on("click", function() {
          return $.ajax({
            url: "/login",
            data: dialogin_box.formtoobj(),
            success: function(e) {
              if (e.error) {
                $("#dialogin-error").show().children("strong").text(e.error);
                return;
              }
              dialogin.close();
              return $.ajax({
                url: prerequest.url,
                data: prerequest.data,
                success: function(e) {
                  if (!exports.check_result(e)) {
                    return;
                  }
                  return window.location.reload();
                }
              });
            }
          });
        });
      }
    }, exports.dialog_config));
  };
  exports.fix_tagmanage = function(box) {
    return $(".tagManager", box).each(function() {
      var source;
      source = $(this).attr("autocomplate_data").split(",");
      return $(this).tagsManager({
        preventSubmitOnEnter: true,
        typeahead: true,
        typeaheadAjaxSource: null,
        typeaheadSource: source,
        blinkBGColor_1: '#FFFF9C',
        blinkBGColor_2: '#CDE69C',
        hiddenInputName: "albums"
      });
    });
  };
  exports.fix_placeholder = function(box) {
    return $("input[placeholder], textarea[placeholder]", box).placeholder();
  };
  exports.fix_selall = function(box) {
    return $("input.selall", box).click(function() {
      return $(this).select();
    });
  };
  exports.fix_bsico = function(box) {
    return $("a[class*='ico[']", box).each(function() {
      var o;
      o = $(this);
      if (o.children("i").length !== 0) {
        return;
      }
      o.bracket({
        space: 'ico'
      });
      o.prepend("<i class='" + o.data('ico')[0] + "'></i>");
      return o.attr("class", o.attr("class").replace(/ico\[[\w-\s]+\]/g, ""));
    });
  };
  exports.fix_holdinput = function(box) {
    return $('input.holdinput', box).holdinput();
  };
  exports.fix_txttime = function(box) {
    return $('input.txttime').datepicker();
  };
  exports.fix_pressbar = function(box) {
    return $(".pressbar", box).each(function() {
      var o, val;
      o = $(this);
      val = parseInt(o.attr("title"));
      if (o.attr("multi")) {
        val = val * o.attr("multi");
      }
      return o.progressbar({
        value: parseInt(val)
      });
    });
  };
  exports.fix_uitips = function(box) {
    return $(".uitips", box).tooltip({
      position: {
        my: "center bottom",
        at: "center top",
        offset: "0 -5"
      }
    });
  };
  exports.fix_png = function(box) {
    if (window.bow === "ie6") {
      return module.load('./front_net/amd-jq/jq_pngFix', function() {
        return $(".png", box).pngFix();
      });
    }
  };
  exports.fix_countable = function(box) {
    return $(".countable", box).each(function() {
      return $(this).countable({
        threshold: 0,
        target: $(this).parent().find(".cttarget"),
        appendMethod: "appendTo",
        positiveCopy: "还可输入{n}个字符"
      });
    });
  };
  exports.fix_facnybox = function(box) {
    $(".fancybox", box).fancybox({
      prevEffect: 'none',
      nextEffect: 'none'
    });
    return $(".fancybox-thumb", box).fancybox({
      prevEffect: 'none',
      nextEffect: 'none',
      helpers: {
        thumbs: {
          width: 100,
          height: 60
        }
      }
    });
  };
});
